import yaml
import os

from utils.handle_path import CONF_DIR

# def get_project_path(file_name):
#     """
#     获取项目目录
#     :return:
#     """
#     project_name = 'python_pratice'
#     # 获取当前脚本（即调用该函数的.py文件）的目录路径
#     file_path = os.path.dirname(__file__)
#     return file_path[: file_path.find(project_name) + len(project_name)]

# def sep(path,add_sep_before=False,add_sep_after=False):
#     all_path = os.sep.join(path)
#     if add_sep_before:
#         all_path = os.sep +all_path
#     if add_sep_after:
#         all_path = all_path + os.sep
#     return all_path

def handle_yaml(file_name):
    # file_path = os.path.dirname(file_name)
    with open(file_name, 'r') as yaml_file:
        yaml_data = yaml.load(yaml_file, Loader=yaml.FullLoader)
    return yaml_data

if __name__ == '__main__':
    conf_path =os.path.join(CONF_DIR,'config.yaml')
    print(handle_yaml(conf_path)['user'])